import xadmin
from xadmin import views

class BaseSetting(object):
    """xadmin的基本配置"""
    enable_themes = True  # 开启主题切换功能
    use_bootswatch = True

xadmin.site.register(views.BaseAdminView, BaseSetting)

class GlobalSettings(object):
    """xadmin的全局配置"""
    site_title = "niubi学城"  # 设置站点标题
    site_footer = "路飞学城有限公司"  # 设置站点的页脚
    menu_style = "accordion"  # 设置菜单折叠

xadmin.site.register(views.CommAdminView, GlobalSettings)


from . import models
class BannerXadmin(object):
    list_display = ['id', 'title', 'link', 'image_url']
    search_fields = ['id', 'title']
    ordering = ['-id']
    refresh_times = [5,10,15,30,60]

xadmin.site.register(models.Banner, BannerXadmin)


# dingbu dibu daohanglan
class NavXadmin(object):
    list_display = ['id', 'title', 'link', ]
    search_fields = ['id', 'title']
    ordering = ['-id']
    refresh_times = [5, 10, 15, 30, 60]

xadmin.site.register(models.Nav, NavXadmin)


'''
 title = models.CharField(max_length=500, verbose_name="导航标题")
    link = models.CharField(max_length=500, verbose_name="导航链接")
    position = models.IntegerField(choices=POSITION_OPTION, default=1, verbose_name="导航位置")
    is_site = models.BooleanField(default=False, verbose_name="是否是站外地址")

'''